package com.itheima.Test;

import java.util.ArrayList;
import java.util.List;import org.hibernate.criterion.DetachedCriteria;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.itheima.domain.Customer;
import com.itheima.service.ICustomerService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations= {"classpath:config/applicationContext.xml"})
public class CustomerServiceTest {
	@Autowired
	private ICustomerService cs;
	
	@Test
	public void testFindAll() {
		DetachedCriteria dCriteria = DetachedCriteria.forClass(Customer.class);
		List list = cs.findAllCustomer(dCriteria);
		for (Object object : list) {
			
			System.out.println(object);
		}
		
		
	}
	
	@Test
	public void save() {
		Customer customer = new Customer();
		customer.setCust_name("test333");
		cs.saveCustomer(customer);
		
	}

}
